// const fs = require("fs").promises

// 同步读取
// const data = fs.readFileSync('./http.js')
// console.log('data',data.toString())

//异步读取
// fs.readFile('./http.js', (err, data) => {
//     //错误优先的回调
//     if(err)throw err;
//     console.log(data.toString());
// })

//promise api async/await

//修饰成promise语法
// const {promise}=require('util')

(
    async()=> {
        const fs = require('fs')
        const { promisify } = require('util')
        const readFile = promisify(fs.readFile)
        const data = await readFile('/http.js')
        console.log(data.toString()) 
    }
)()